﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;

namespace EquipmentConfig.Class
{
	public class StructData
	{
		/// <summary>
		/// 读取设备命令协议
		/// </summary>
		public struct Read_Device
		{
			/// <summary>
			/// ID
			/// </summary>
			public byte ID;

			/// <summary>
			/// 功能码
			/// </summary>
			public byte Fun;

			/// <summary>
			/// 数据长度
			/// </summary>
			public ushort Length;

			/// <summary>
			/// CRC校验码
			/// </summary>
			public ushort CRC16;
		}

		/// <summary>
		/// 设备基本信息
		/// </summary>
		[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
		public struct Device_Info
		{
			/// <summary>
			/// 设备序列号
			/// </summary>
			[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
			public char[] SN;

			/// <summary>
			/// 硬件版本
			/// </summary>
			[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
			public byte[] HardwaveVer;

			/// <summary>
			/// 软件版本
			/// </summary>
			[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
			public byte[] ProgramVer;

			/// <summary>
			/// BIOS版本
			/// </summary>
			[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
			public byte[] BiosVer;

			/// <summary>
			///电源电压
			/// </summary>
			[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
			public byte[] Voltage;

			/// <summary>
			/// 设备温度
			/// </summary>
			[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
			public byte[] Temperature;

			/// <summary>
			///数据采集周期
			/// </summary>
			public byte DataAcquisitionCycle;

            /// <summary>
            ///SIM卡状态
            /// </summary>
            public byte SIMStatus;

            /// <summary>
            ///信号强度
            /// </summary>
            public byte Signal;

            /// <summary>
            ///设备时间
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
            public byte[] DeviceTime;

			/// <summary>
			///GPRS 网络制式
			/// </summary>
			public byte GSMType;

			/// <summary>
			///系统状态标志位
			/// </summary>
			[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
			public byte[] SystemStatus;

            /// <summary>
            ///中心站1接口状态
            /// </summary>
            public byte CenterStatus1;

            /// <summary>
            ///中心站2接口状态
            /// </summary>
            public byte CenterStatus2;

            /// <summary>
            ///中心站3接口状态
            /// </summary>
            public byte CenterStatus3;

            /// <summary>
            ///中心站1上传状态
            /// </summary>
            public byte CenterUploadStatus1;

            /// <summary>
            ///中心站2上传状态
            /// </summary>
            public byte CenterUploadStatus2;

            /// <summary>
            ///中心站3上传状态
            /// </summary>
            public byte CenterUploadStatus3;

            /// <summary>
            ///中心站1发送成功次数
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] CenterSendSuccessCount1;

            /// <summary>
            ///中心站1发送失败次数
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] CenterFailCount1;

            /// <summary>
            ///中心站1缓存次数
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] CenterCacheCount1;

            /// <summary>
            ///中心站2发送成功次数
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] CenterSendSuccessCount2;

            /// <summary>
            ///中心站2发送失败次数
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] CenterFailCount2;

            /// <summary>
            ///中心站2缓存次数
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] CenterCacheCount2;

            /// <summary>
            ///中心站3发送成功次数
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] CenterSendSuccessCount3;

            /// <summary>
            ///中心站3发送失败次数
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] CenterFailCount3;

            /// <summary>
            ///中心站3缓存次数
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
            public byte[] CenterCacheCount3;
        }
	}
}